package com.xiaoma.tpo.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xiaoma.tpo.dao.PcVisitDeviceDao;
import com.xiaoma.tpo.domain.PcVisitDevice;

@Service
public class PcVisitDeviceService {

    @Autowired
    private PcVisitDeviceDao dao;
    
    public void save(PcVisitDevice deviceInfo) {
        dao.insert(deviceInfo);
    }
    public void update(PcVisitDevice deviceInfo) {
        dao.update(deviceInfo);
    }
    
    public PcVisitDevice getByDeviceNo(String deviceNo) {
        PcVisitDevice entity = new PcVisitDevice();
        entity.setDeviceNo(deviceNo);
        List<PcVisitDevice> devices = dao.findByColumns(entity);
        return devices.size() > 0 ? devices.get(0) : null;
    }
}
